<div class="row">
  <div class="col-md-12">
    <h1 class="page-header">文件管理
      <small>查看 管理文件</small>
    </h1>
  </div>
</div>
<div class="row m-b-10" ng-show="currentUser.authorities[0]==='AOWEI_ADMIN'">
  <div class="col-md-12">
    <button type="button" class="btn btn-sm btn-inverse pull-right" ng-click="import()">
      <i class="fa fa-cloud-upload" aria-hidden="true"></i>&nbsp;上传文件
    </button>
  </div>
</div>
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-inverse">
      <div class="panel-heading">
        <div class="panel-heading-btn">
          <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-collapse">
            <i class="fa fa-2x fa-angle-down"></i></a>
        </div>
        <h4 class="panel-title">汇总文件</h4>
      </div>
      <div class="panel-body">
        <div ng-show="summaryFileData.length===0" class="text-center p-t-20 p-b-20">
          <h5>暂无文件</h5>
        </div>
        <div ng-show="summaryFileData.length!==0">
          <table class="table text-center">
            <thead>
            <tr>
              <th class="text-center">序号</th>
              <th class="text-center">文件名</th>
              <th class="text-center">上传时间</th>
              <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr data-ng-repeat="file in summaryFileData">
              <td>{{$index+1}}</td>
              <td>{{file.ul_filename}}</td>
              <td>{{file.ul_time}}</td>
              <td>
                <a href="#" class="m-r-10" style="color: #b6c2c9;"
                   ng-click="download(file.tag,file.ul_filename)">
                  <i class="fa fa-cloud-download" aria-hidden="true"></i>
                </a>
                <a href="#" class="m-r-10" style="color: #b6c2c9;" ng-click="delete(file.ul_filename,file.id)"
                   ng-show="currentUser.authorities[0]==='AOWEI_ADMIN'">
                  <i class="fa fa-trash-o" aria-hidden="true"></i>
                </a>
              </td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-inverse">
      <div class="panel-heading">
        <div class="panel-heading-btn">
          <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-collapse">
            <i class="fa fa-2x fa-angle-down"></i></a>
        </div>
        <h4 class="panel-title">文件列表</h4>
      </div>
      <div class="panel-body">
        <div ng-show="totalElements===0" class="text-center p-t-20 p-b-20">
          <h5>暂无文件</h5>
        </div>
        <div ng-show="totalElements!==0">
          <table class="table text-center">
            <thead>
            <tr>
              <th class="text-center">序号</th>
              <th class="text-center">文件名</th>
              <th class="text-center" ng-hide="currentUser.authorities[0]==='SUNING_USER'">门店名</th>
              <th class="text-center">上传时间</th>
              <th class="text-center" ng-hide="currentUser.authorities[0]==='AOWEI_ADMIN'">状态</th>
              <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr data-ng-repeat="file in fileData">
              <td>{{$index+2*(currentPage-1)+1}}</td>
              <td>{{file.ul_filename}}</td>
              <td ng-hide="currentUser.authorities[0]==='SUNING_USER'">{{file.tag}}</td>
              <td>{{file.ul_time}}</td>
              <td ng-hide="currentUser.authorities[0]==='AOWEI_ADMIN'">
                <label class="label label-danger"
                       ng-if="currentUser.authorities[0]==='SUNING_USER'&&file.status===1">
                  已申诉
                </label>
                <label class="label label-success"
                       ng-if="currentUser.authorities[0]==='SUNING_USER'&&file.status===2">
                  申诉已处理
                </label>
                <label class="label label-danger"
                       ng-if="currentUser.authorities[0]==='SUNING_ADMIN'&&file.status===1">
                  待处理</label>
                <label class="label label-success"
                       ng-if="currentUser.authorities[0]==='SUNING_ADMIN'&&file.status===2">
                  已处理
                </label>
              </td>
              <td>
                <a href="#" class="m-r-10" style="color: #b6c2c9;"
                   ng-click="deal(file.ul_filename,file.status,file.appeal_context,file.answer_context,file.id)"
                   ng-show="currentUser.authorities[0]==='SUNING_ADMIN'&&file.status!==0">
                  <i class="fa fa-hourglass-start" aria-hidden="true"></i>
                </a>
                <a href="#" class="m-r-10" style="color: #b6c2c9;"
                   ng-click="appeal(file.ul_filename,file.status,file.appeal_context,file.answer_context,file.id)"
                   ng-show="currentUser.authorities[0]==='SUNING_USER'">
                  <i class="fa fa-flag" aria-hidden="true"></i>
                </a>
                <a href="#" class="m-r-10" style="color: #b6c2c9;"
                   ng-click="download(file.tag,file.ul_filename)">
                  <i class="fa fa-cloud-download" aria-hidden="true"></i>
                </a>
                <a href="#" class="m-r-10" style="color: #b6c2c9;" ng-click="delete(file.ul_filename,file.id)"
                   ng-show="currentUser.authorities[0]==='AOWEI_ADMIN'">
                  <i class="fa fa-trash-o" aria-hidden="true"></i>
                </a>
              </td>
            </tr>
            </tbody>
          </table>
          <div>
            <ul uib-pagination total-items="totalElements" ng-model="currentPage" max-size="5" items-per-page="20" class="pagination-sm pull-right m-t-0" boundary-link-numbers="true" rotate="true"
                previous-text="&lsaquo;" next-text="&rsaquo;" ng-change="pageChanged()">
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
